﻿#ifndef _NPCMANAGER_H_
#define _NPCMANAGER_H_


#include "msgDefine.h"
#include "GameNpc.h"
#include "GamePlayer.h"

typedef fvoid	(*CommandFun2)( GameNpc* , GamePlayer* , SEND_MSG_TALK_NPC* msg );


typedef map< fint32 , CommandFun2 > MapCommand2;
typedef map< fint32 , CommandFun2 >::iterator MapCommandIter2;


class NpcManager : public baseSingle< NpcManager >
{
public:

	NpcManager();
	~NpcManager();
    
    fvoid               Load( const fbyte* path );
    fvoid               LoadTemplate( const fbyte* path );
    

	fvoid				Init();
	fvoid				Release();
	
	fvoid				TalkNpc( SANpcType type , GameNpc* n , GamePlayer* p , SEND_MSG_TALK_NPC* msg );
	
    GameNpc*            GetNpc( fint32 id );
    
protected:

    GameNpc*            CreateNpc( NpcCreateData* data );
    
    

	static fvoid	CommandWarpMan( GameNpc* n , GamePlayer* p , SEND_MSG_TALK_NPC* msg );
	static fvoid	CommandWarp( GameNpc* n , GamePlayer* p , SEND_MSG_TALK_NPC* msg );
	static fvoid	CommandSavePoint( GameNpc* n , GamePlayer* p , SEND_MSG_TALK_NPC* msg );
	static fvoid	CommandFight( GameNpc* n , GamePlayer* p , SEND_MSG_TALK_NPC* msg );
	static fvoid	CommandQuest( GameNpc* n , GamePlayer* p , SEND_MSG_TALK_NPC* msg );
	static fvoid	CommandShop( GameNpc* n , GamePlayer* p , SEND_MSG_TALK_NPC* msg );
	static fvoid	CommandMan( GameNpc* n , GamePlayer* p , SEND_MSG_TALK_NPC* msg );
	static fvoid	CommandHealer( GameNpc* n , GamePlayer* p , SEND_MSG_TALK_NPC* msg );
	static fvoid	CommandCharm( GameNpc* n , GamePlayer* p , SEND_MSG_TALK_NPC* msg );
	static fvoid	CommandPetShot( GameNpc* n , GamePlayer* p , SEND_MSG_TALK_NPC* msg );
	static fvoid	CommandSignBoard( GameNpc* n , GamePlayer* p , SEND_MSG_TALK_NPC* msg );
	static fvoid	CommandDengon( GameNpc* n , GamePlayer* p , SEND_MSG_TALK_NPC* msg );
	static fvoid	CommandPoolItemShop( GameNpc* n , GamePlayer* p , SEND_MSG_TALK_NPC* msg );
	static fvoid	CommandTransMan( GameNpc* n , GamePlayer* p , SEND_MSG_TALK_NPC* msg );
	static fvoid	CommandItemChange( GameNpc* n , GamePlayer* p , SEND_MSG_TALK_NPC* msg );
	static fvoid	CommandProfessionShop( GameNpc* n , GamePlayer* p , SEND_MSG_TALK_NPC* msg );
	static fvoid	CommandFreePetSkill( GameNpc* n , GamePlayer* p , SEND_MSG_TALK_NPC* msg );
	static fvoid	CommandPetSkillShop( GameNpc* n , GamePlayer* p , SEND_MSG_TALK_NPC* msg );
	static fvoid	CommandPetFusion( GameNpc* n , GamePlayer* p , SEND_MSG_TALK_NPC* msg );
	static fvoid	CommandWindowMan( GameNpc* n , GamePlayer* p , SEND_MSG_TALK_NPC* msg );
	static fvoid	CommandLimitShop( GameNpc* n , GamePlayer* p , SEND_MSG_TALK_NPC* msg );
	static fvoid	CommandTimeMan( GameNpc* n , GamePlayer* p , SEND_MSG_TALK_NPC* msg );
	static fvoid	CommandLuckyMan( GameNpc* n , GamePlayer* p , SEND_MSG_TALK_NPC* msg );
	static fvoid	CommandFamilyMan( GameNpc* n , GamePlayer* p , SEND_MSG_TALK_NPC* msg );
	static fvoid	CommandBankMan( GameNpc* n , GamePlayer* p , SEND_MSG_TALK_NPC* msg );
	static fvoid	CommandGambleBank( GameNpc* n , GamePlayer* p , SEND_MSG_TALK_NPC* msg );





private:

    NpcARGDataVector        mARGDataVector;
    NpcCreateDataVector     mCreateDataVector;
    NpcTemplateDataVector   mTemplateDataVector;
    NpcTemplateDataMap      mTemplateDataMap;
    
    GameNpcMap              mNpcMap;
    GameNpcVector           mNpcVector;
    
	static MapCommand2      mCommands;

};


extern NpcManager* gNpcManager;


#endif

